{% extends "index.html" %} 

{% block title %}Administration{% endblock %}

{% block head %}
<link href="/static/css/jHtmlArea.css" rel="stylesheet" type="text/css" />
{% endblock %}

{% block content %}
<div class="panel">
	<div class="hd"></div>
	<div class="bd">
		<form id="entity_form" method="post" action="/admin/entity/{{ actionUrl }}">
			<input type="hidden" name="id_id" value="{{ id_field }}">
			<table>
			{{ form_body }}
			</table>
			<input type="submit" value="Save" onclick="return submitHTML()"/>
		</form>
	</div>	
</div>
{% endblock %}

{% block lpanel %}
<div><a href="/admin/entity/{{ actionUrl }}">Cancel</a></div>
{% endblock %}

{% block rpanel %}{% endblock %}
  
{% block scripts %}
<script src="/static/js/jHtmlArea-0.6.0.js" type="text/javascript"></script>
<script type="text/javascript">
function submitHTML(){
	$("textarea").each(function() {
		jh=this.jhtmlareaObject;
		txt=jh.toHtmlString();
		txt=txt.replace(/%7B/g,"{").replace(/%7D/g,"}");
		jh.textarea.val(txt);
		//this.jhtmlareaObject.updateTextArea();
	});
	return true;
}
$(function() {
	$("textarea").attr('cols',80).attr('rows',20).htmlarea();
});
</script>
{% endblock %}